home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
config.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
8KB
|
253 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import shutil
import const
from quodlibet.util.config import Config, Error
AUTO_ENABLED_PLUGINS = [
'Shuffle Playlist',
'Remove Playlist Duplicates']
INITIAL = {
'header_maps': { },
'player': {
'time_remaining': 'false',
'replaygain': 'on',
'fallback_gain': '0.0',
'pre_amp_gain': '0.0',
'backend': 'gstbe',
'gst_pipeline': '',
'gst_buffer': '1.5',
'gst_device': '',
'gst_disable_gapless': 'false' },
'library': {
'exclude': '',
'refresh_on_start': 'true' },
'memory': {
'song': '',
'seek': '0',
'volume': '1.0',
'browser': 'PanedBrowser',
'songlist': 'true',
'queue': 'false',
'shufflequeue': 'false',
'sortby': '0album',
'order': 'inorder',
'order_shuffle': 'shuffle',
'shuffle': 'false',
'plugin_selection': '',
'column_widths': '',
'column_expands': '' },
'browsers': {
'query_text': '',
'panes': '~people\t<~year|[b][i]<~year>[/i][/b] - ><album>',
'pane_selection': '',
'pane_wide_mode': '0',
'background': '',
'albums': '',
'album_sort': '0',
'album_covers': '1',
'album_substrings': '1',
'collection_headers': '~people 0',
'radio': '',
'rating_click': 'true',
'rating_confirm_multiple': 'false',
'cover_size': '-1',
'search_limit': 'false' },
'settings': {
'scan': '',
'jump': 'true',
'default_rating': '0.5',
'ratings': '4',
'bayesian_rating_factor': '0.0',
'rating_symbol_full': '\xe2\x98\x85',
'rating_symbol_blank': '\xe2\x98\x86',
'repeat': 'false',
'disable_hints': 'false',
'eager_search': 'true' },
'rename': {
'spaces': 'false',
'windows': 'true',
'ascii': 'false' },
'tagsfrompath': {
'underscores': 'false',
'titlecase': 'false',
'split': 'false',
'add': 'false' },
'plugins': {
'active_plugins': '\n'.join(AUTO_ENABLED_PLUGINS),
'default_max_plugin_invocations': 30 },
'editing': {
'split_on': '/ & ,',
'id3encoding': '',
'human_title_case': 'true',
'save_to_songs': 'true',
'save_email': const.EMAIL,
'alltags': 'true',
'auto_save_changes': 'false',
'default_tags': '' },
'albumart': {
'round': 'true',
'prefer_embedded': 'false',
'force_filename': 'false',
'filename': 'folder.jpg' } }
_config = Config(version = 0)
options = _config.options
get = _config.get
getboolean = _config.getboolean
getint = _config.getint
getfloat = _config.getfloat
getstringlist = _config.getstringlist
setstringlist = _config.setstringlist
set = _config.set
setdefault = _config.setdefault
write = _config.write
reset = _config.reset
add_section = _config.add_section
has_option = _config.has_option
remove_option = _config.remove_option
register_upgrade_function = _config.register_upgrade_function
def init(filename = None, initial = None):
if not _config.is_empty():
raise ValueError('config initialized twice without quitting: %r' % _config.sections())
if initial is None:
initial = INITIAL
for section, values in initial.iteritems():
_config.add_section(section)
for key, value in values.iteritems():
_config.set_inital(section, key, value)
if filename is not None:
try:
_config.read(filename)
except (Error, EnvironmentError):
print_w('Reading config file %r failed.' % filename)
try:
shutil.copy(filename, filename + '.not-valid')
except EnvironmentError:
pass
def save(filename):
'''Writes the active config to filename, ignoring all possible errors'''
print_d('Writing config...')
try:
_config.write(filename)
except EnvironmentError:
print_w('Unable to write config.')
def quit():
'''Clears the active config'''
_config.clear()
def state(arg):
return _config.getboolean('settings', arg)
class RatingsPrefs(object):
'''
Models Ratings settings as configured by the user, with caching.
'''
def __init__(self):
self._RatingsPrefs__number = None
self._RatingsPrefs__default = None
self._RatingsPrefs__full_symbol = None
self._RatingsPrefs__blank_symbol = None
def precision(self):
'''Returns the smallest ratings delta currently configured'''
return 1 / self.number
precision = property(precision)
def number(self):
if self._RatingsPrefs__number is None:
self._RatingsPrefs__number = getint('settings', 'ratings')
return self._RatingsPrefs__number
number = property(number)
def number(self, i):
'''The (maximum) integer number of ratings icons configured'''
self._RatingsPrefs__number = self._RatingsPrefs__save('ratings', int(i))
number = number.setter(number)
def default(self):
'''The current default floating-point rating'''
if self._RatingsPrefs__default is None:
self._RatingsPrefs__default = getfloat('settings', 'default_rating')
return self._RatingsPrefs__default
default = property(default)
def default(self, f):
self._RatingsPrefs__default = self._RatingsPrefs__save('default_rating', float(f))
default = default.setter(default)
def full_symbol(self):
'''The symbol to use for a full (active) rating'''
if self._RatingsPrefs__full_symbol is None:
self._RatingsPrefs__full_symbol = self._RatingsPrefs__get_symbol('full')
return self._RatingsPrefs__full_symbol
full_symbol = property(full_symbol)
def full_symbol(self, s):
self._RatingsPrefs__full_symbol = self._RatingsPrefs__save('rating_symbol_full', s)
full_symbol = full_symbol.setter(full_symbol)
def blank_symbol(self):
'''The symbol to use for a blank (inactive) rating, if needed'''
if self._RatingsPrefs__blank_symbol is None:
self._RatingsPrefs__blank_symbol = self._RatingsPrefs__get_symbol('blank')
return self._RatingsPrefs__blank_symbol
blank_symbol = property(blank_symbol)
def blank_symbol(self, s):
self._RatingsPrefs__blank_symbol = self._RatingsPrefs__save('rating_symbol_blank', s)
blank_symbol = blank_symbol.setter(blank_symbol)
def all(self):
'''Returns all the possible ratings currently available'''
return [ float(i) / self.number for i in range(0, self.number + 1) ]
all = property(all)
def __save(key, value):
set('settings', key, value)
return value
__save = staticmethod(__save)
def __get_symbol(variant = 'full'):
return get('settings', 'rating_symbol_%s' % variant).decode('utf-8')
__get_symbol = staticmethod(__get_symbol)
class HardCodedRatingsPrefs(RatingsPrefs):
number = int(INITIAL['settings']['ratings'])
default = float(INITIAL['settings']['default_rating'])
blank_symbol = INITIAL['settings']['rating_symbol_blank'].decode('utf-8')
full_symbol = INITIAL['settings']['rating_symbol_full'].decode('utf-8')
RATINGS = RatingsPrefs()